<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>新增编码</title>
	<#include "./comm/meta-base.ftl" />
	<#include "./comm/meta-easyui.ftl" />
	<#include "./comm/meta-comm.ftl" />
</head>
<body>
		
<form id="data_form" role="form" class="page-form"   method="post" >
 	<!--表单块-->
	<div class="form-title">一级码表</div>
	<div class="row">
		
		<div class="form-group col-sm-6 ">
			<label class="col-sm-4 fm-label">一级编码</label>
			<div class="col-sm-8 fm-control">
				<input type="text" name="lookupType" id="lookupType" class="form-control easyui-validatebox" data-options="required:true,validType:['length[2,2]']" />
			</div>
		</div>
		
		<div class="form-group col-sm-6">
			<label class="col-sm-4 fm-label">一级编码名称</label>
			<div class="col-sm-8 fm-control" style="">
				<input type="text" name="typeName" class="form-control easyui-validatebox" data-options="required:true" />
			</div>
		</div>
	
	</div>

	
	<div class="form-title" >二级编码</div>
	<div class="row" >
		<div class="buttons-preview" style="border:0px;" >
			<a class="btn btn-default  btn-sm" 
            	href="javascript:addOperate()"><i class="fa fa-plus"></i>添加二级编码</a>
		</div>
		<table class="table   table-bordered ">
			<thead>
				<tr>
					<th width="250">二级编码</th>
					<th width="250">二级编码名称</th>
					<th width="250">组编码</th>
					<th >操作</th>
				</tr>
			</thead>
			<tbody id="app-tbody">
				
			</tbody>
		</table>
		
	</div>
    
    <!--表单操作按钮区-->
    <div class="but-row-bottom-shadow"></div>
    <div class="buts-row-bottom row ">
		<a href="javascript:submitForm();"  class="btn btn-success">
				<i class="fa fa-check"></i>提 交</a>
		<a href="javascript:closeWindow('新增编码');" class="btn btn-default">
				<i class="fa fa-times"></i>取 消</a>
	</div>
 </form>
</body>
</html>
<script type="text/javascript">
//提交表单
function submitForm(){
	$("#data_form").form('submit', {
		url : '${basePath}/lookup/lookup-save',
		onSubmit: function (){
			showPageShade();//当提交时候，显示遮罩层
			if(!$(this).form('validate')){//页面验证
				hiddenPageShade();//未成功，隐藏遮罩层
				return false;
			}
			return true;
        },
		success : function(result) {
			hiddenPageShade();//成功后，隐藏遮罩层
			closeWindowRefrresh("新增编码");
		}
	});
}



function removeOperate(obj){
	var $this=$(obj);
	$this.parent().parent().remove();
	
}
function addOperate(){
	var lookupType=$("#lookupType").val();
	
	var html="<tr>"+
			"<td><input type=\"text\" value=\""+lookupType+"\" name=\"lookupCodeArray\" class=\" form-control easyui-validatebox\" data-options=\"required:true,validType:['length[3,3]']\" style=\"height:28px;width:230px;\"/></td>"+
			"<td><input type=\"text\" name=\"codeNameArray\" class=\"form-control easyui-validatebox\" data-options=\"required:true\"  style=\"height:28px;width:230px;\"/></td>"+
			"<td><input type=\"text\" name=\"groupCodeArray\" class=\"form-control easyui-validatebox\" data-options=\"\"  style=\"height:28px;width:230px;\"/></td>"+
			"<td><a class=\"btn btn-danger btn-xs icon-only white\" onclick=\"removeOperate(this)\" href=\"javascript:void(0);\"><i class=\"fa fa-times \"></i></a></td>"+
		"</tr>";
	$("#app-tbody").append(html);
	$.parser.parse($("#app-tbody"));
}

</script>


